package model;

import java.util.ArrayList;

public class Consultant {
	private int id;
	private String nom;
	private String prenom;
	private String adresse;
	private String telephone;
	private ArrayList<String> listCompetence;

	public Consultant() {
		super();
	}

	public Consultant(String nom, String prenom, String adresse,
			String telephone) {
		super();
		this.listCompetence = new ArrayList<String>();
		this.nom = nom;
		this.prenom = prenom;
		this.adresse = adresse;
		this.telephone = telephone;
	}

	public Consultant(int id, String nom, String prenom, String adresse,
			String telephone) {
		super();
		this.id = id;
		this.listCompetence = new ArrayList<String>();
		this.nom = nom;
		this.prenom = prenom;
		this.adresse = adresse;
		this.telephone = telephone;
	}

	public void addSkill(String nom) {
		listCompetence.add(nom);
	}

	public boolean removeSkill(String nom) {
		boolean succes = false;
		try {
			listCompetence.remove(nom);
			succes = true;
		} catch (Exception e) {
			System.out.println("Competence introuvable");
		}
		return succes;
	}

	public ArrayList<String> getSkills() {
		return listCompetence;
	}

	public boolean compareSkills(ArrayList<String> listSkill) {
		for (String s : listCompetence) {
			for (String s2 : listSkill) {
				if (s.equals(s2))
					return true;
			}
		}
		return false;
	}

	public boolean hasSkill(String skill) {
		for (String s : listCompetence) {
			if (s.equals(skill))
				return true;
		}
		return false;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getPrenom() {
		return prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public String getAdresse() {
		return adresse;
	}

	public void setAdresse(String adresse) {
		this.adresse = adresse;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	@Override
	public String toString() {
		return "Consultant [id=" + id + ", nom=" + nom + ", prenom=" + prenom
				+ ", adresse=" + adresse + ", telephone=" + telephone + "]";
	}
}
